import { getPackageList } from '../list/api'
import { getServiceList } from '../service/api'

/**
 * @Author: Wang chunsheng  email:2192138785@qq.com
 * @Date:   2024-02-07 21:48:04
 * @Last Modified by:   Wang chunsheng  email:2192138785@qq.com
 * @Last Modified time: 2024-02-13 08:29:27
 */
export const form = {
  package_id: {
    label: '选择套餐',
    // 只需要在这里指定为 tree-select 即可
    type: 'tree-select',
    // 属性参考: https://vue-treeselect.js.org/
    attrs: {
      multiple: false,
      clearable: true
    },
    options: async data => {
      const res = await getPackageList()
      return res.data
    }
  },
  service_id: {
    label: '选择服务',
    // 只需要在这里指定为 tree-select 即可
    type: 'tree-select',
    // 属性参考: https://vue-treeselect.js.org/
    attrs: {
      multiple: true,
      clearable: true
    },
    options: async data => {
      const res = await getServiceList(0)
      return res.data
    }
  },
  'usage_limit': {
    'type': 'number',
    'label': '使用限制'
  }
}

export const order = ['package_id', 'service_id', 'usage_limit']

export const tableColumns = [{
  'label': 'ID',
  'prop': 'id'
}, {
  'label': '套餐ID',
  'prop': 'package_id'
}, {
  'label': '服务ID',
  'prop': 'service_id'
}, {
  'label': '使用限制',
  'prop': 'usage_limit'
}, {
  'label': '创建时间',
  'prop': 'create_time'
}, {
  'label': '更新时间',
  'prop': 'update_time'
}, {
  'label': '操作',
  'prop': 'action',
  'slot': 'action'
}]

export const filterInfo = {
  fieldList: {
    'label': '更新时间',
    'type': 'input',
    'value': 'DiandiSubscriptionPackageService[update_time]'
  }

}

export const path = {
  index: 'diandi-subscription-package-package-service-index',
  update: 'diandi-subscription-package-package-service-update',
  create: 'diandi-subscription-package-package-service-create',
  api: '/diandi_subscription/package/package-service'
}

export const rowKey = 'id'
